package log

import (
	"parking-lot-go-admin/controller"

	"github.com/gin-gonic/gin"
)

// 日志文件夹
var xiaoQiangReceiveDirPath = receiveDirPathBase + "xiaoqiang/"
var xiaoQiangPushDirPath = pushDirPathBase + "xiaoqiang/"

// 入参记录
func XiaoQiangReceive(c *gin.Context) {
	prefix := "receive_error.log."

	fileNames := fileList(xiaoQiangReceiveDirPath, prefix)

	controller.Success(c,
		map[string]interface{}{
			"list":        fileNames,
			"prefix":      xiaoQiangReceiveDirPath + prefix,
			"total":       len(fileNames),
			"pageSize":    30,
			"currentPage": 1,
		})
}

// 进/出场记录
func XiaoQiangPush(c *gin.Context) {
	prefix := "push_error.log."

	fileNames := fileList(xiaoQiangPushDirPath, prefix)

	controller.Success(c,
		map[string]interface{}{
			"list":        fileNames,
			"prefix":      xiaoQiangPushDirPath + prefix,
			"total":       len(fileNames),
			"pageSize":    30,
			"currentPage": 1,
		})
}

// 扣费
func XiaoQiangDeductMoney(c *gin.Context) {
	prefix := "push_error.log."

	fileNames := fileList(xiaoQiangReceiveDirPath, prefix)

	controller.Success(c,
		map[string]interface{}{
			"list":        fileNames,
			"prefix":      xiaoQiangReceiveDirPath + prefix,
			"total":       len(fileNames),
			"pageSize":    30,
			"currentPage": 1,
		})
}
